using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;

namespace LMSData{
    /// <summary>
    /// Strongly-typed collection for the YafVaccess class.
    /// </summary>
    [Serializable]
    public partial class YafVaccessCollection : ReadOnlyList<YafVaccess, YafVaccessCollection>
    {        
        public YafVaccessCollection() {}

    }

    /// <summary>
    /// This is  Read-only wrapper class for the yaf_vaccess view.
    /// </summary>
    [Serializable]
    public partial class YafVaccess : ReadOnlyRecord<YafVaccess> 
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }

	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }

                return BaseSchema;
            }

        }

    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("yaf_vaccess", TableType.View, DataService.GetInstance("LMS"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = "dbo";
                //columns
                
                TableSchema.TableColumn colvarUserID = new TableSchema.TableColumn(schema);
                colvarUserID.ColumnName = "UserID";
                colvarUserID.DataType = DbType.Int32;
                colvarUserID.MaxLength = 0;
                colvarUserID.AutoIncrement = false;
                colvarUserID.IsNullable = false;
                colvarUserID.IsPrimaryKey = false;
                colvarUserID.IsForeignKey = false;
                colvarUserID.IsReadOnly = false;
                
                schema.Columns.Add(colvarUserID);
                
                TableSchema.TableColumn colvarForumID = new TableSchema.TableColumn(schema);
                colvarForumID.ColumnName = "ForumID";
                colvarForumID.DataType = DbType.Int32;
                colvarForumID.MaxLength = 0;
                colvarForumID.AutoIncrement = false;
                colvarForumID.IsNullable = true;
                colvarForumID.IsPrimaryKey = false;
                colvarForumID.IsForeignKey = false;
                colvarForumID.IsReadOnly = false;
                
                schema.Columns.Add(colvarForumID);
                
                TableSchema.TableColumn colvarIsAdmin = new TableSchema.TableColumn(schema);
                colvarIsAdmin.ColumnName = "IsAdmin";
                colvarIsAdmin.DataType = DbType.Int32;
                colvarIsAdmin.MaxLength = 0;
                colvarIsAdmin.AutoIncrement = false;
                colvarIsAdmin.IsNullable = true;
                colvarIsAdmin.IsPrimaryKey = false;
                colvarIsAdmin.IsForeignKey = false;
                colvarIsAdmin.IsReadOnly = false;
                
                schema.Columns.Add(colvarIsAdmin);
                
                TableSchema.TableColumn colvarIsGuest = new TableSchema.TableColumn(schema);
                colvarIsGuest.ColumnName = "IsGuest";
                colvarIsGuest.DataType = DbType.Int32;
                colvarIsGuest.MaxLength = 0;
                colvarIsGuest.AutoIncrement = false;
                colvarIsGuest.IsNullable = true;
                colvarIsGuest.IsPrimaryKey = false;
                colvarIsGuest.IsForeignKey = false;
                colvarIsGuest.IsReadOnly = false;
                
                schema.Columns.Add(colvarIsGuest);
                
                TableSchema.TableColumn colvarIsForumModerator = new TableSchema.TableColumn(schema);
                colvarIsForumModerator.ColumnName = "IsForumModerator";
                colvarIsForumModerator.DataType = DbType.Int32;
                colvarIsForumModerator.MaxLength = 0;
                colvarIsForumModerator.AutoIncrement = false;
                colvarIsForumModerator.IsNullable = true;
                colvarIsForumModerator.IsPrimaryKey = false;
                colvarIsForumModerator.IsForeignKey = false;
                colvarIsForumModerator.IsReadOnly = false;
                
                schema.Columns.Add(colvarIsForumModerator);
                
                TableSchema.TableColumn colvarIsModerator = new TableSchema.TableColumn(schema);
                colvarIsModerator.ColumnName = "IsModerator";
                colvarIsModerator.DataType = DbType.Int32;
                colvarIsModerator.MaxLength = 0;
                colvarIsModerator.AutoIncrement = false;
                colvarIsModerator.IsNullable = true;
                colvarIsModerator.IsPrimaryKey = false;
                colvarIsModerator.IsForeignKey = false;
                colvarIsModerator.IsReadOnly = false;
                
                schema.Columns.Add(colvarIsModerator);
                
                TableSchema.TableColumn colvarReadAccess = new TableSchema.TableColumn(schema);
                colvarReadAccess.ColumnName = "ReadAccess";
                colvarReadAccess.DataType = DbType.Int32;
                colvarReadAccess.MaxLength = 0;
                colvarReadAccess.AutoIncrement = false;
                colvarReadAccess.IsNullable = true;
                colvarReadAccess.IsPrimaryKey = false;
                colvarReadAccess.IsForeignKey = false;
                colvarReadAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarReadAccess);
                
                TableSchema.TableColumn colvarPostAccess = new TableSchema.TableColumn(schema);
                colvarPostAccess.ColumnName = "PostAccess";
                colvarPostAccess.DataType = DbType.Int32;
                colvarPostAccess.MaxLength = 0;
                colvarPostAccess.AutoIncrement = false;
                colvarPostAccess.IsNullable = true;
                colvarPostAccess.IsPrimaryKey = false;
                colvarPostAccess.IsForeignKey = false;
                colvarPostAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarPostAccess);
                
                TableSchema.TableColumn colvarReplyAccess = new TableSchema.TableColumn(schema);
                colvarReplyAccess.ColumnName = "ReplyAccess";
                colvarReplyAccess.DataType = DbType.Int32;
                colvarReplyAccess.MaxLength = 0;
                colvarReplyAccess.AutoIncrement = false;
                colvarReplyAccess.IsNullable = true;
                colvarReplyAccess.IsPrimaryKey = false;
                colvarReplyAccess.IsForeignKey = false;
                colvarReplyAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarReplyAccess);
                
                TableSchema.TableColumn colvarPriorityAccess = new TableSchema.TableColumn(schema);
                colvarPriorityAccess.ColumnName = "PriorityAccess";
                colvarPriorityAccess.DataType = DbType.Int32;
                colvarPriorityAccess.MaxLength = 0;
                colvarPriorityAccess.AutoIncrement = false;
                colvarPriorityAccess.IsNullable = true;
                colvarPriorityAccess.IsPrimaryKey = false;
                colvarPriorityAccess.IsForeignKey = false;
                colvarPriorityAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarPriorityAccess);
                
                TableSchema.TableColumn colvarPollAccess = new TableSchema.TableColumn(schema);
                colvarPollAccess.ColumnName = "PollAccess";
                colvarPollAccess.DataType = DbType.Int32;
                colvarPollAccess.MaxLength = 0;
                colvarPollAccess.AutoIncrement = false;
                colvarPollAccess.IsNullable = true;
                colvarPollAccess.IsPrimaryKey = false;
                colvarPollAccess.IsForeignKey = false;
                colvarPollAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarPollAccess);
                
                TableSchema.TableColumn colvarVoteAccess = new TableSchema.TableColumn(schema);
                colvarVoteAccess.ColumnName = "VoteAccess";
                colvarVoteAccess.DataType = DbType.Int32;
                colvarVoteAccess.MaxLength = 0;
                colvarVoteAccess.AutoIncrement = false;
                colvarVoteAccess.IsNullable = true;
                colvarVoteAccess.IsPrimaryKey = false;
                colvarVoteAccess.IsForeignKey = false;
                colvarVoteAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarVoteAccess);
                
                TableSchema.TableColumn colvarModeratorAccess = new TableSchema.TableColumn(schema);
                colvarModeratorAccess.ColumnName = "ModeratorAccess";
                colvarModeratorAccess.DataType = DbType.Int32;
                colvarModeratorAccess.MaxLength = 0;
                colvarModeratorAccess.AutoIncrement = false;
                colvarModeratorAccess.IsNullable = true;
                colvarModeratorAccess.IsPrimaryKey = false;
                colvarModeratorAccess.IsForeignKey = false;
                colvarModeratorAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarModeratorAccess);
                
                TableSchema.TableColumn colvarEditAccess = new TableSchema.TableColumn(schema);
                colvarEditAccess.ColumnName = "EditAccess";
                colvarEditAccess.DataType = DbType.Int32;
                colvarEditAccess.MaxLength = 0;
                colvarEditAccess.AutoIncrement = false;
                colvarEditAccess.IsNullable = true;
                colvarEditAccess.IsPrimaryKey = false;
                colvarEditAccess.IsForeignKey = false;
                colvarEditAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarEditAccess);
                
                TableSchema.TableColumn colvarDeleteAccess = new TableSchema.TableColumn(schema);
                colvarDeleteAccess.ColumnName = "DeleteAccess";
                colvarDeleteAccess.DataType = DbType.Int32;
                colvarDeleteAccess.MaxLength = 0;
                colvarDeleteAccess.AutoIncrement = false;
                colvarDeleteAccess.IsNullable = true;
                colvarDeleteAccess.IsPrimaryKey = false;
                colvarDeleteAccess.IsForeignKey = false;
                colvarDeleteAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarDeleteAccess);
                
                TableSchema.TableColumn colvarUploadAccess = new TableSchema.TableColumn(schema);
                colvarUploadAccess.ColumnName = "UploadAccess";
                colvarUploadAccess.DataType = DbType.Int32;
                colvarUploadAccess.MaxLength = 0;
                colvarUploadAccess.AutoIncrement = false;
                colvarUploadAccess.IsNullable = true;
                colvarUploadAccess.IsPrimaryKey = false;
                colvarUploadAccess.IsForeignKey = false;
                colvarUploadAccess.IsReadOnly = false;
                
                schema.Columns.Add(colvarUploadAccess);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["LMS"].AddSchema("yaf_vaccess",schema);
            }

        }

        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }

	    #endregion
	    
	    #region .ctors
	    public YafVaccess()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }

        public YafVaccess(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}

			MarkNew();
	    }

	    
	    public YafVaccess(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }

    	 
	    public YafVaccess(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }

        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("UserID")]
        public int UserID 
	    {
		    get
		    {
			    return GetColumnValue<int>("UserID");
		    }

            set 
		    {
			    SetColumnValue("UserID", value);
            }

        }

	      
        [XmlAttribute("ForumID")]
        public int? ForumID 
	    {
		    get
		    {
			    return GetColumnValue<int?>("ForumID");
		    }

            set 
		    {
			    SetColumnValue("ForumID", value);
            }

        }

	      
        [XmlAttribute("IsAdmin")]
        public int? IsAdmin 
	    {
		    get
		    {
			    return GetColumnValue<int?>("IsAdmin");
		    }

            set 
		    {
			    SetColumnValue("IsAdmin", value);
            }

        }

	      
        [XmlAttribute("IsGuest")]
        public int? IsGuest 
	    {
		    get
		    {
			    return GetColumnValue<int?>("IsGuest");
		    }

            set 
		    {
			    SetColumnValue("IsGuest", value);
            }

        }

	      
        [XmlAttribute("IsForumModerator")]
        public int? IsForumModerator 
	    {
		    get
		    {
			    return GetColumnValue<int?>("IsForumModerator");
		    }

            set 
		    {
			    SetColumnValue("IsForumModerator", value);
            }

        }

	      
        [XmlAttribute("IsModerator")]
        public int? IsModerator 
	    {
		    get
		    {
			    return GetColumnValue<int?>("IsModerator");
		    }

            set 
		    {
			    SetColumnValue("IsModerator", value);
            }

        }

	      
        [XmlAttribute("ReadAccess")]
        public int? ReadAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("ReadAccess");
		    }

            set 
		    {
			    SetColumnValue("ReadAccess", value);
            }

        }

	      
        [XmlAttribute("PostAccess")]
        public int? PostAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("PostAccess");
		    }

            set 
		    {
			    SetColumnValue("PostAccess", value);
            }

        }

	      
        [XmlAttribute("ReplyAccess")]
        public int? ReplyAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("ReplyAccess");
		    }

            set 
		    {
			    SetColumnValue("ReplyAccess", value);
            }

        }

	      
        [XmlAttribute("PriorityAccess")]
        public int? PriorityAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("PriorityAccess");
		    }

            set 
		    {
			    SetColumnValue("PriorityAccess", value);
            }

        }

	      
        [XmlAttribute("PollAccess")]
        public int? PollAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("PollAccess");
		    }

            set 
		    {
			    SetColumnValue("PollAccess", value);
            }

        }

	      
        [XmlAttribute("VoteAccess")]
        public int? VoteAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("VoteAccess");
		    }

            set 
		    {
			    SetColumnValue("VoteAccess", value);
            }

        }

	      
        [XmlAttribute("ModeratorAccess")]
        public int? ModeratorAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("ModeratorAccess");
		    }

            set 
		    {
			    SetColumnValue("ModeratorAccess", value);
            }

        }

	      
        [XmlAttribute("EditAccess")]
        public int? EditAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("EditAccess");
		    }

            set 
		    {
			    SetColumnValue("EditAccess", value);
            }

        }

	      
        [XmlAttribute("DeleteAccess")]
        public int? DeleteAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("DeleteAccess");
		    }

            set 
		    {
			    SetColumnValue("DeleteAccess", value);
            }

        }

	      
        [XmlAttribute("UploadAccess")]
        public int? UploadAccess 
	    {
		    get
		    {
			    return GetColumnValue<int?>("UploadAccess");
		    }

            set 
		    {
			    SetColumnValue("UploadAccess", value);
            }

        }

	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string UserID = @"UserID";
            
            public static string ForumID = @"ForumID";
            
            public static string IsAdmin = @"IsAdmin";
            
            public static string IsGuest = @"IsGuest";
            
            public static string IsForumModerator = @"IsForumModerator";
            
            public static string IsModerator = @"IsModerator";
            
            public static string ReadAccess = @"ReadAccess";
            
            public static string PostAccess = @"PostAccess";
            
            public static string ReplyAccess = @"ReplyAccess";
            
            public static string PriorityAccess = @"PriorityAccess";
            
            public static string PollAccess = @"PollAccess";
            
            public static string VoteAccess = @"VoteAccess";
            
            public static string ModeratorAccess = @"ModeratorAccess";
            
            public static string EditAccess = @"EditAccess";
            
            public static string DeleteAccess = @"DeleteAccess";
            
            public static string UploadAccess = @"UploadAccess";
            
	    }

	    #endregion
    }

}

